﻿namespace CS.Beehive
{
    /// <summary>
    /// 传输中的报文
    /// </summary>
    public class Datagram
    {

        public Datagram()
        {
        }

        public Datagram(int bufferSize)
        {
            Buffer = new byte[bufferSize];
        }

        /// <summary>
        /// 数据Buffer
        /// </summary>
        internal byte[] Buffer { get; set; }
        /// <summary>
        /// 偏移量
        /// </summary>
        public int Offset { get; set; }
        /// <summary>
        /// 从偏移量起始处的数量
        /// </summary>
        public int Count { get; set; }


        public void Reset()
        {
            lock (this)
            {
                Offset = 0;
                Count = 0;
            }
        }

    }
}